package com.cljh.mapper;

import com.cljh.bean.Calendar;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CalendarMapper {

    @Select("select * from mtmall_test.calendar where calendar.date=#{date} and calendar.admin_id=#{adminId};")
    Calendar selectByDate(@Param("date") String  date, @Param("adminId") Integer adminId);

    @Insert("insert into mtmall_test.calendar (calendar.date, content,admin_id) values (#{calendar.date},#{calendar.content},#{calendar.adminId});")
    int save(@Param("calendar") Calendar calendar);

    @Select("select * from mtmall_test.calendar where admin_id = #{adminId} ;")
    List<Calendar> selectAll(@Param("adminId")Integer adminId);

    @Update("update mtmall_test.calendar set mtmall_test.calendar.content = #{calendar.content} where mtmall_test.calendar.date=#{calendar.date} and mtmall_test.calendar.admin_id =#{calendar.adminId};")
    int upd(@Param("calendar") Calendar calendar);
}
